import rclpy
from rclpy.node import  Node
from std_msgs.msg import String


class Listener(Node):
    def __init__(self):
        super().__init__('listener_node_py')
        self.get_logger().info('订阅创建py')
        self.subscription_=self.create_subscription(String,'chatter',
                                                    self.lister_callback,10)
    def lister_callback(self,msg: String):
        self.get_logger().info(f'订阅收到py{msg.data}')
        pass    
def main():
    rclpy.init()
    rclpy.spin(Listener())
    rclpy.shutdown()


if __name__=='__main__':
    main()